{% extends 'learning_logs/base.html' %}
{% load bootstrap3 %}

{% block header %}
    <h2>
        {{ suite }}
    </h2>
{% endblock header %}

{% block content %}

    <p>

        <a href="{% url 'ETP:job' suite.job_id%}"> << 返回 </a>

        {% if suite.type == 'api' %}
            <a href="{% url 'ETP:new_apistep' suite.id %}">新增Step</a>
        {% elif suite.type == 'ui' %}
            <a href="{% url 'ETP:new_uistep' suite.id %}">新增Step</a>
        {% endif %}
    </p>


    {% if suite.type == 'api'%}
        <table class="table table-bordered">
            <thead class="">
                <tr>
                    <th>执行序号</th>
                    <th>请求地址</th>
                    <th>请求方式</th>
                    <th>请求header</th>
                    <th>请求参数</th>
                    <th>请求json</th>
                    <th>预期结果</th>
                    <th>运行结果</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {% for step in steps %}
                    <tr>
                        <td>{{ step.run_order }}</td>
                        <td>{{ step.api_url }}</td>
                        <td>{{ step.api_method }}</td>
                        <td>{{ step.api_header }}</td>
                        <td>{{ step.api_params }}</td>
                        <td>{{ step.api_json }}</td>
                        <td>{{ step.api_expect }}</td>
                        <td>{{ step.result }}</td>
                        <td>
    {#                        <a href="{% url 'ETP:suite' suite.id %}">详情</a>#}
                            <a href="{% url 'ETP:edit_apistep' step.id %}">修改</a>
                            {% if step.run_order == steps.count %}
                                <a href="{% url 'ETP:delete_step' step.id %}">删除</a>
                            {% else %}
                                <a></a>
                            {% endif %}
                        </td>
                    </tr>
                {% endfor%}
            </tbody>
        </table>
    {% elif suite.type == 'ui' %}
        <table class="table table-bordered">
            <thead class="">
                <tr>
                    <th>执行序号</th>
                    <th>操作</th>
                    <th>元素定位方式</th>
                    <th>元素定位表达式</th>
                    <th>操作数据</th>
                    <th>执行结果</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {% for step in steps %}
                    <tr>
                        <td>{{ step.run_order }}</td>
                        <td>{{ step.ui_operation }}</td>
                        <td>{{ step.ui_locate_method }}</td>
                        <td>{{ step.ui_locate_url }}</td>
                        <td>{{ step.ui_data }}</td>
                        <td>{{ step.result }}</td>
                        <td>
                            <a href="{% url 'ETP:edit_uistep' step.id %}">修改</a>
                            {% if step.run_order == steps.count %}
                                <a href="{% url 'ETP:delete_step' step.id%}">删除</a>
                            {% else %}
                                <a></a>
                            {% endif %}
                        </td>
                    </tr>
                {% endfor%}
            </tbody>
        </table>
    {% endif %}



{% endblock content %}